<?php
namespace app\clerk\controller\store;
use app\clerk\controller\Controller;
use app\clerk\model\ShopClerk as ShopClerkModel;

/**
 * 店员控制器
 */
class User extends Controller
{
    /**
     * 更新当前店员信息
     */
    public function renew()
    {
        $model = ShopClerkModel::detail($this->clerk['user']['shop_clerk_id']);
        if ($this->request->isAjax()) {
            if ($model->renew($this->postData('user'))) {
                return $this->renderSuccess('更新成功');
            }
            return $this->renderError($model->getError() ?: '更新失败');
        }
        return $this->fetch('renew', compact('model'));
    }
}
